#!/usr/bin/env python
# -*- coding: utf-8 -*-

from web.manager.log_manager import LogManager
from web.service.base_service import BaseService

Logger = LogManager.get_logger(__name__)

"""
StockTransactionDataAll的service类
"""


class StockTransactionDataAllService(BaseService):

    def find_average_close_price_between_date_order_by_date_asc(self, code, begin_date, end_date):
        """
        查询一段时间内的平均收盘价，并按照日期升序排列
        """

        return self.stock_transaction_data_all_dao.find_average_close_price_between_date_order_by_date_asc(code,
                                                                                                           begin_date,
                                                                                                           end_date)

    def update_total_market_value_and_circulation_market_value_by_code_and_date(self, code: str,
                                                                                total_market_value: float,
                                                                                circulation_market_value: float,
                                                                                date: str):
        """
        根据code、date，更新total_market_value和circulation_market_value
        """

        self.stock_transaction_data_all_dao.update_total_market_value_and_circulation_market_value_by_code_and_date(
            code, total_market_value, circulation_market_value, date)

    def update_pe_and_pb_and_ps_and_peg_and_dy_by_code_and_date(self, code, date, pe, pb, ps, peg, dy):
        """
        根据code、date，更新市盈率、市净率、市销率、市盈率相对盈利增长比率和股息率
        """

        self.stock_transaction_data_all_dao.update_pe_and_pb_and_ps_and_peg_and_dy_by_code_and_date(
            code, date, pe, pb, ps, peg, dy)
